cmd1 = " -P2R | grep 'enter' | wc > 1"
cmd2 = " -P2R | grep 'left' | wc > 2"
cmd = "nachos -rs "
1.upto(1000) do |i|
  command1 = cmd+i.to_s+cmd1
  command2 = cmd+i.to_s+cmd2
  system(command1)
  system(command2)
  a = 0
  b = 0
  File.open("1") do |file|
    line = file.gets.split
    a = line[0]
  end
  File.open("2") do |file|
    line = file.gets.split
    b = line[0]
  end
  if a != b
    puts (i.to_s+" ERROR.........................................")
  else
    puts i.to_s+" CORRECT!"
  end
end